<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: register.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."register.php";
include LOCALE.LOCALESET."user_fields.php";

//Henter avloser id fra URL for å hente riktig kontrakter fra DB
$avloserid=$_GET['avloserid'];
$forerkortid=$_GET['forerkortid'];

//Oppkobling mot databasen. Opkoblingsinfo ligger i config.php
$db = mysql_connect($GLOBALS['db_host'], $GLOBALS['db_user'], $GLOBALS['db_password']);
mysql_select_db($GLOBALS['db_name'], $db); 		


$query1="DELETE FROM arbeidserfaring WHERE arbeidserfaring.avloserid=$avloserid"; 
		mysql_query($query1);

$query2="DELETE FROM arbeidskontrakt WHERE arbeidskontrakt.avloserid=$avloserid"; 
		mysql_query($query2);

$query3="DELETE FROM avlosermote WHERE avlosermote.avloserid=$avloserid";
		mysql_query($query3);

$query4="DELETE FROM avloserskole WHERE avloserskole.avloserid=$avloserid"; 
		mysql_query($query4);

$query5="DELETE FROM egenvurdering  WHERE egenvurdering.avloserid=$avloserid";
		mysql_query($query5);

$query6="DELETE FROM oppkjoringklasse WHERE oppkjoringklasse.forerkortid=$forerkortid"; 
		mysql_query($query6);
		
$query7="DELETE FROM forerkortklasse WHERE forerkortklasse.forerkortid=$forerkortid";
		mysql_query($query7);
				
$query8="DELETE FROM forerkort  WHERE forerkort.avloserid=$avloserid"; 
		mysql_query($query8); 

$query9="DELETE FROM images WHERE images.avloserid=$avloserid"; 
		mysql_query($query9); 
		
$query10="DELETE FROM kommentar WHERE kommentar.kommentarid=$avloserid"; 
		mysql_query($query10);

$query11="DELETE FROM kurs_sertifikat WHERE kurs_sertifikat.avloserid=$avloserid"; 
		mysql_query($query11);
		

$query12="DELETE FROM skolegang WHERE skolegang.avloserid=$avloserid";
		mysql_query($query12);
		
$query13="DELETE FROM arbeidstype WHERE arbeidstype.avloserid=$avloserid";
		mysql_query($query13);

$query14="DELETE FROM avloser WHERE avloser.avloserid=$avloserid";
		mysql_query($query14);
		

		
opentable($locale['401']);

echo $locale['global_107'];
closetable();
		
header("Refresh: 1; url=visning.php");
		
require_once THEMES."templates/footer.php";

?>